package com.cntcdt.api.db.dao;

import java.util.List;

import com.cntcdt.api.db.dao.base.MoneyOperateDaoBase;
import com.cntcdt.api.db.model.MoneyOperateModel;

/**
 * 这是money_operate的Dao实现类
 */
public class MoneyOperateDao extends MoneyOperateDaoBase {
	/**
	 * MoneyOperateDao对象
	 */
	private static MoneyOperateDao instance = new MoneyOperateDao();

	/**
	 * 默认构造方法
	 */
	private MoneyOperateDao() {
	}

	/**
	 * 获得对象实例
	 */
	public static MoneyOperateDao getInstance() {
		return instance;
	}

	/**
	 * 根据用户id查询手动充值记录
	 * 
	 * @param userId
	 * @param sortTime
	 * @return
	 */
	public List<MoneyOperateModel> findByUserId(int userId, int sortTime) {
		sortTime = sortTime * 20;
		String sql = "select * from " + TABLE + " where userId = ? order by addTime desc limit ?,20";
		Object[] paramObjs = { userId, sortTime };
		List<MoneyOperateModel> modelList = this.queryModelList(sql, paramObjs);
		return modelList;
	}
}
